function a(a, t, e) {
    return t in a ? Object.defineProperty(a, t, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : a[t] = e, a;
}

var t, e = getApp();

Page({
    data: (t = {
        data: [],
        teamId: "",
        date: "2018-08-22",
        showDate: "2018年8月22日"
    }, a(t, "data", []), a(t, "hadLoading", !1), t),
    loadData: function() {
        var a = this;
        e.network.post({
            url: e.url.teamTodayDanScheduleList,
            params: {
                teamId: a.data.teamId,
                scheduleDate: a.data.date
            },
            before: function() {
                wx.showNavigationBarLoading();
            },
            success: function(t) {
                1 == t.data.result ? a.setData({
                    data: t.data.data.schedules
                }) : e.util.showToast(t.data.message);
            },
            fail: function() {
                e.util.showToast("获取设置失败");
            },
            complete: function() {
                a.setData({
                    hadLoading: !0
                }), wx.hideNavigationBarLoading();
            }
        });
    },
    onLoad: function(a) {
        var t = new Date(), e = t.getFullYear(), n = t.getMonth() + 1, o = t.getDate();
        n < 10 && (n = "0" + n), o < 10 && (o = "0" + o), this.setData({
            teamId: a.teamId,
            showDate: e + "年" + n + "月" + o + "日",
            date: e + "-" + n + "-" + o
        }), this.loadData();
    },
    clickNext: function(a) {
        this.changeDate(1);
    },
    clickLast: function(a) {
        this.changeDate(-1);
    },
    bindDateChange: function(a) {
        console.log("picker发送选择改变，携带值为", a.detail.value);
        var t = new Date(a.detail.value), e = t.getFullYear(), n = t.getMonth() + 1, o = t.getDate();
        n < 10 && (n = "0" + n), o < 10 && (o = "0" + o), this.setData({
            showDate: e + "年" + n + "月" + o + "日",
            date: e + "-" + n + "-" + o
        }), this.loadData();
    },
    changeDate: function(a) {
        var t = this.addDate(this.data.date, a), e = t[0], n = t[1], o = t[2];
        n < 10 && (n = "0" + n), o < 10 && (o = "0" + o), this.setData({
            showDate: e + "年" + n + "月" + o + "日",
            date: e + "-" + n + "-" + o
        }), this.loadData();
    },
    addDate: function(a, t) {
        var e = new Date(a);
        e.setDate(e.getDate() + t);
        var n = e.getMonth() + 1;
        return [ e.getFullYear(), n, e.getDate() ];
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});